﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CRM.Controller;
using CRM.Entity.Extra;

namespace CRM.Web.Admin
{
    public partial class Home : System.Web.UI.Page
    {
        public string pics = "''";
        public string links = "''";
        public string texts = "''";
        TextInfoController textInfoController = new TextInfoController();

        protected void Page_Load(object sender, EventArgs e)
        {
            pics = "'images/HomePic/1.jpg'" + "+ '|' +" + "'images/HomePic/2.jpg'" + " + '| '+" + "'images/HomePic/3.jpg'" + "+ '| '+" + "'images/HomePic/4.jpg'";
            //links = "'Img.aspx'" + "+ '|' +" + "'1/4.jpg'" + " + '| '+" + "'1/2.jpg'" + "+ '| '+" + "'1/3.jpg'";
            //texts = "'标题'" + "+ '|' +" + "'1/4.jpg'" + " + '| '+" + "'1/2.jpg'" + "+ '| '+" + "'1/3.jpg'";
            if (!IsPostBack)
            {
                BindData();
            }
        }

        protected void BindData()
        {
            var pageIndex = 1;
            var pageSize = 20;
            var pageInfo = new PageInfo()
            {
                PageIndex = pageIndex,
                PageSize = pageSize
            };

            var textInfoPage = textInfoController.GetListExtra(pageInfo);
            if (textInfoPage.ListEntity != null)
            {
                foreach (var info in textInfoPage.ListEntity)
                {
                    switch (info.TextKey)
                    {
                        case "网站标题":

                            break;
                        case "网站首页简介":
                            corpIntro.Text = info.TextValue;
                            break;
                        case "网站首页左下角标题":
                            partLeftTitle.Text = info.TextValue;
                            break;
                        case "网站首页左下角内容":
                            partLeftContent.InnerText = info.TextValue;
                            break;
                        case "网站首页右下角标题":
                            partRightTitle.Text = info.TextValue;                             
                            break;
                        case "网站首页右下角内容":
                            partRightContent.InnerText = info.TextValue;
                            break;

                        default:
                            break;
                    }
                }
            }


        }
    }
}